const fs = require('fs').promises
const path = require('path')
/**
 * 
 * generator + co 语法糖
 */

async function read() {
    try {
        let a = await fs.readFile(path.resolve('./name.txt'), 'utf-8')
        let b = await fs.readFile(a, 'utf-8')
        return b
    } catch (error) {
        console.log(error)
    }
}

read().then(res => {
    console.log(res)
}).catch(e => {
    console.log(e)
})